package zcj.stu.buttondemo;

import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class ButtonActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_button);
        TextView textView =(TextView) findViewById(R.id.textView);
        Button button =(Button) findViewById(R.id.button);
        button.setOnClickListener(v -> {
            Button b=(Button)v;
            b.setText("不要点我了");
            textView.setText("被点击过了");
            System.out.println("按钮被点击了...");
        });
        ImageButton imageButton = (ImageButton)findViewById(R.id.imageButton);
        imageButton.setOnClickListener((ib)->{
            ImageButton fib=(ImageButton)ib;
            button.setText("button。。。。");
        });
    }
}